package com.semidata.trp.business.data;

import java.util.List;

import org.apache.ibatis.session.SqlSession;

import com.semidata.trp.business.mapper.ServerMapper;
import com.semidata.trp.business.model.DecisionServerModel;
import com.semidata.trp.business.model.MonitorServerModel;
import com.semidata.trp.business.utils.SessionUtils;

public class ServerData {

    private List<DecisionServerModel> decisionList;
    private List<MonitorServerModel> monitorList;

    public ServerData() {
        load();
    }

    private void load() {
        try {
            SqlSession session = SessionUtils.getSession();

            ServerMapper mapper = session.getMapper(ServerMapper.class);

            decisionList = mapper.getDecisionServers();
            monitorList = mapper.getMonitorServers();
            session.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public List<DecisionServerModel> getDecisionList() {
        return decisionList;
    }

    public List<MonitorServerModel> getMonitorList() {
        return monitorList;
    }
}
